const obj = {
  name: 'angular',
  age: 16
};

const arr = ['a', 'b'];

const set = new Set([...arr]);

// js
for(const key in obj) {
  console.log(`key: ${key}, value: ${obj[key]}`);
  // key: name, value: angular
  // key: age, value: 16
}

for(const item of set) {
  console.log(item);
  // a
  // b
}

arr.forEach((item, index) => {
  console.log(item, index);
  // a 0
  // b 1
}); 

Object.keys(obj).forEach(key => {
  console.log(`key: ${key}, value: ${obj[key]}`);
  // key: name, value: angular
  // key: age, value: 16
});

// angular-js

angular.forEach(obj, (key, value) => {
  console.log(`key: ${value}, value: ${key}`);
});

angular.forEach(arr, (key, value) => {
  console.log(`key: ${value}, value: ${key}`);
});